<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li ><a href="{:url('evaluate/index')}">列表</a></li>
			<li class="active"><a >{:lang('EDIT')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('evaluate/editPost')}">
            <div class="form-group">
				<label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>类型</label>
				<div class="col-md-6 col-sm-10" id="type">
                    <volist name="type" id="v">
					<label class="radio-inline"><input type="radio" name="type" value="{$key}" <if condition="$key eq $data['type']">checked</if>>{$v}</label>
                    </volist>
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name" name="name" value="{$data['name']}">
				</div>
			</div>
			<div class="form-group">
				<label for="input-name_en" class="col-sm-2 control-label"><span class="form-required">*</span>Name</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name_en" name="name_en" value="{$data['name_en']}">
				</div>
			</div>
            
            <div class="form-group" id="colour" <if condition="$data['type'] eq 0">style="display:none;"</if>>
				<label for="input-colour" class="col-sm-2 control-label"><span class="form-required">*</span>颜色</label>
				<div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control js-color" name="colour" readonly value="{$data['colour']}" style="display:inline-block;width:200px;"> 
                    <input  class="form-control colour_block" style="display:inline-block;width:50px;background:{$data['colour']};" disabled/>
				</div>
			</div>

            <div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="hidden" name="id" value="{$data.id}" />
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
				</div>
			</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script>
        (function(){
            $("#type label").click(function(){
                var type=$("input",this).val();
                if(type==0){
                    $("#colour").hide();
                }else{
                    $("#colour").show();
                }
            
            })
            Wind.use('colorpicker',function(){
                $('.js-color').each(function () {
                    var $this=$(this);
                    $this.ColorPicker({
                        livePreview:true,
                        onChange: function(hsb, hex, rgb) {
                            $this.val('#'+hex);
                            $this.siblings(".colour_block").css('background','#'+hex);
                        },
                        onBeforeShow: function () {
                            $(this).ColorPickerSetColor(this.value);
                        }
                    });
                });

            });
        
        
        })()
        
      </script>
</body>
</html>